package models;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import play.db.jpa.Model;

@Entity
/***
 * this class represents the choices of the exercise having 
 * attributes of the owner question and the choice itself
 * @author hadeer
 *
 */
public class Choice extends Model {
	public String choice;
	@ManyToOne
	@JoinColumn(name = "choicesofexercise")
	public Question myQuestion;

	public Choice(String choice, long qid) {
		this.choice = choice;
		myQuestion = Question.findById(qid);
		save();
	}
/***
 * this constructor returns the choice
 * @author hadeer
 * @return
 */
	public String getChoice() {
		return choice;
	}
/***
 * this method sets the choice with the new choice for a certain question
 * @author hadeer
 * @param choice
 */
	public void setChoice(String choice) {
		this.choice = choice;
	}
/***
 * this method return the question which the choice is related to
 * @author hadeer
 * @return
 */
	public Question getMyQuestion() {
		return myQuestion;
	}
/***
 * this method sets the question of choice
 * @author hadeer
 * @param myQuestion
 */
	public void setMyQuestion(Question myQuestion) {
		this.myQuestion = myQuestion;
	}
}
